home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Workspace / Locus / Source / ActivatorBarView.m < prev    next >
Text File  |  1995-06-12  |  2KB  |  126 lines

  1.  
  2. /*
  3.     Copyright 1993  Jeremy Slade.
  4.  
  5.     You are free to use all or any parts of the Locus project
  6.     however you wish, just give credit where credit is due.
  7.     The author (Jeremy Slade) shall not be held responsible
  8.     for any damages that result out of use or misuse of any
  9.     part of this project.
  10.  
  11. */
  12.  
  13. /*
  14.     Project: Locus
  15.  
  16.     File: ActivatorBarView.m
  17.  
  18.     Description: See ActivatorBarView.h
  19.  
  20.     Original Author: Jeremy Slade
  21.  
  22.     Revision History:
  23.         Created
  24.             V.101    JGS Tue Feb  2 18:47:52 GMT-0700 1993
  25.  
  26. */
  27.  
  28.  
  29. #import "ActivatorBarView.h"
  30.  
  31. #import "ActivatorBar.h"
  32. #import "Globals.h"
  33. #import "PSWraps.h"
  34.  
  35. #import <dpsclient/psops.h>
  36.  
  37.  
  38. @implementation ActivatorBarView
  39.  
  40.  
  41. + initialize
  42. {
  43.     [self setVersion:ActivatorBarView_VERSION];
  44.     return ( self );
  45. }
  46.  
  47.  
  48.  
  49. - initFrame:(const NXRect *)rect
  50. {
  51.     [super initFrame:rect];
  52.     
  53.     // Set the default fill and border colors:
  54.     fillColor = NX_COLORWHITE;
  55.     borderColor = NX_COLORBLACK;
  56.     
  57.     return ( self );
  58. }
  59.  
  60.  
  61.  
  62. - setColor:(NXColor)color
  63. /*
  64.     Set the view's fill color -- the color used to fill the interior
  65. */
  66. {
  67.     fillColor = color;
  68.     if ( vFlags.disableAutodisplay ) [self setNeedsDisplay:YES];
  69.         else [self display];
  70.     return ( self );
  71. }
  72.  
  73.  
  74.  
  75. - setBorderColor:(NXColor)color
  76. /*
  77.     Set the view's border color -- the color used to draw the border
  78. */
  79. {
  80.     borderColor = color;
  81.     if ( vFlags.disableAutodisplay ) [self setNeedsDisplay:YES];
  82.         else [self display];
  83.     return ( self );
  84. }
  85.  
  86.  
  87.  
  88. - drawSelf:(const NXRect *)rects :(int)rectCount
  89. /*
  90.     Draw the view -- fills the entire view with the border color, then draws a rectangle inside using the fill color that is 1 pixel shorter on each side.
  91. */
  92. {
  93.     NXRect rect = bounds;
  94.         
  95.     // Draw border using borderColor
  96.     NXSetColor ( borderColor );
  97.     NXRectFill ( &rect );
  98.     
  99.     // Fill interior with fillColor;
  100.     rect.origin.x += 1;
  101.     rect.origin.y += 1;
  102.     rect.size.width -= 2;
  103.     rect.size.height -= 2;
  104.     NXSetColor ( fillColor );
  105.     NXRectFill ( &rect );
  106.     
  107.     return ( self );
  108. }
  109.  
  110.  
  111.  
  112. - mouseDown:(NXEvent *)event
  113. /*
  114.     Trap mouseDown: events (if it is a single-click) and tell our window (an ActivatorBar) that we were hit.
  115. */
  116. {
  117.     // Only send barHit: on single mouse-click
  118.     if ( event->data.mouse.click == 1 )
  119.         [window tryToPerform:@selector(barHit:) with:self];
  120.     return ( self );
  121. }
  122.  
  123.  
  124.  
  125. @end
  126.